package top.kaoshanji.q1ch07a;

import top.kaoshanji.y1constant.FileConstant;

import java.io.*;

/**
 * 代码清单-q1ch07a-331页a：文本文件输出的快捷方式
 * author kaoshanji
 * ^_^
 * create time 2025/3/12 16:00
 */
public class FileOutputShortcut {

    static String pathStr = FileConstant.LOCAL_ROOT_PATH.concat("q1ch07a331页a\\");
    static String file = pathStr.concat("FileOutputShortcut.dat");

    public static void main(String[] args) {

        try (BufferedReader in = new BufferedReader(new StringReader(BufferedInputFile.read(pathStr.concat("FileOutputShortcut.java"))));
            // 下面是该快捷方式
             PrintWriter out = new PrintWriter(file)
        ){

            in.lines().forEach(out::println);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        System.out.println(BufferedInputFile.read(file));
    }



}
